#define _CRT_SECURE_NO_WARNINGS 1
#include"vector.h"
#include<vector>

namespace vct
{
	void test1()
	{
		vector<int> v1(5, 10);
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		cout << v1.size() << endl;
		cout << v1.capacity() << endl;

		vector<int>::iterator it = v1.begin();
		while (it != v1.end())
		{
			cout << *it << " ";
			*it = 2;
			it++;
		}
		cout << endl;
		v1.pop_back();
		v1.pop_back();
		v1.pop_back();
		it = v1.begin();
		while (it != v1.end())
		{
			cout << *it << " ";
			it++;
		}
		cout << endl;
	}

	void test2()
	{
		vector<int> v1(10,8);
		vector<int> v2(v1);
		vector<int>::iterator it1 = v2.begin();
		while (it1 != v2.end())
		{
			cout << *it1 << " ";
			it1++;
		}
		cout << endl;
		vector<int> v3 = v2;

		vector<int>::iterator it2 = v3.begin();
		while (it2 != v3.end())
		{
			cout << *it2 << " ";
			it2++;
		}
	}

	void test3()
	{
		vector<string> v1(10, "hahaha");
		vector<string> v2(v1);

		vector<string>::iterator it1 = v2.begin();
		while (it1 != v2.end())
		{
			cout << *it1 << " ";
			it1++;
		}
		cout << endl;
		vector<string> v3 = v2;

		vector<string>::iterator it2 = v3.begin();
		while (it2 != v3.end())
		{
			cout << *it2 << " ";
			it2++;
		}
	}

	void test4()
	{
		vector<int> v1;
		v1.push_back(1);
		v1.push_back(2);
		v1.push_back(3);
		v1.push_back(4);
		v1.push_back(5);
		v1.push_back(6);

		vector<int>::iterator pos = find(v1.begin(), v1.end(), 2);

		//v1.insert(pos, 9);
		//v1.erase(pos);
		v1.erase(v1.begin() + 3, v1.begin()+4);


		vector<int>::iterator it1 = v1.begin();
		while (it1 != v1.end())
		{
			cout << *it1 << " ";
			it1++;
		}

		cout << endl << v1.size() << endl;
		v1.resize(15, 0);
		it1 = v1.begin();
		while (it1 != v1.end())
		{
			cout << *it1 << " ";
			it1++;
		}
		cout << endl << v1.size() << endl;

	}
}

//void test4()
//{
//	vector<int> v1;
//	v1.push_back(1);
//	v1.push_back(2);
//	v1.push_back(3);
//	v1.push_back(4);
//	v1.push_back(5);
//	v1.push_back(6);
//
//	vector<int>::iterator pos = find(v1.begin(), v1.end(), 2);
//
//	//v1.insert(pos, 9);
//	//v1.erase(pos);
//	v1.erase(v1.begin() + 3, v1.end());
//
//	vector<int>::iterator it1 = v1.begin();
//	while (it1 != v1.end())
//	{
//		cout << *it1 << " ";
//		it1++;
//	}
//	cout << endl << v1.size() << endl;
//}

int main()
{
	vct::test4();
	
	return 0;
}